package com.yanqu.road.entity.activity.newyearbag;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.string.StringUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_s_activity_newyearbag_draw")
public class NewYearBagDrawConfig {

    @FieldTypeAnnotation(desc = "活动ID", select = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "奖励ID")
    private int rewardId;
    @FieldTypeAnnotation(desc = "奖励类型")
    private int rewardType;
    @FieldTypeAnnotation(desc = "奖励")
    private String reward;
    @FieldTypeAnnotation(desc = "权重")
    private List<Integer> weightList; // 下标 = NewYearBagLimitConfig.userLimit - 1
    @FieldTypeAnnotation(desc = "身份限制")
    private int titleLimit;

    @FieldTypeAnnotation(desc = "实物道具限量(天数=限量|天数=限量|……  )")
    private Map<Integer, Integer> itemLimitMap = new HashMap<>();

    @FieldTypeAnnotation(desc = "是否大奖")
    private int isBigAward;

    @FieldTypeAnnotation(desc = "实物道具达到上限后权重变化")
    private String shiwuChangeWeight;

    private Map<Integer, Integer> changeWeightMap = new HashMap<>();


    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getRewardId() {
        return rewardId;
    }

    public void setRewardId(int rewardId) {
        this.rewardId = rewardId;
    }

    public int getRewardType() {
        return rewardType;
    }

    public void setRewardType(int rewardType) {
        this.rewardType = rewardType;
    }

    public String getReward() {
        return reward;
    }

    public void setReward(String reward) {
        this.reward = reward;
    }

    public List<Integer> getWeightList() {
        return weightList;
    }

    public void setWeightList(List<Integer> weightList) {
        this.weightList = weightList;
    }

    public int getTitleLimit() {
        return titleLimit;
    }

    public void setTitleLimit(int titleLimit) {
        this.titleLimit = titleLimit;
    }

    public Map<Integer, Integer> getItemLimitMap() {
        return itemLimitMap;
    }

    public void setItemLimitMap(Map<Integer, Integer> itemLimitMap) {
        this.itemLimitMap = itemLimitMap;
    }

    public int getIsBigAward() {
        return isBigAward;
    }

    public void setIsBigAward(int isBigAward) {
        this.isBigAward = isBigAward;
    }

    public Map<Integer, Integer> getChangeWeightMap() {
        return changeWeightMap;
    }

    public void setChangeWeightMap(Map<Integer, Integer> changeWeightMap) {
        this.changeWeightMap = changeWeightMap;
    }

    public void setChangeWeight(String shiWuChangeWeight) {
        this.shiwuChangeWeight = shiWuChangeWeight;

        Map<Integer, Integer> map = new ConcurrentHashMap<>();

        if(!"0".equals(shiWuChangeWeight)) {
            List<Integer> list = StringUtils.stringToIntegerList(shiWuChangeWeight, "=");
            map.put(list.get(0), list.get(1));
        }

        this.changeWeightMap = map;
    }

    public String getShiwuChangeWeight() {
        return shiwuChangeWeight;
    }
}
